// https : // iai.sh.cn/problem/577

#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> nums(n);
  vector<int> count(3, 0);

  // 输入数据并统计每个数字的出现次数
  for (int i = 0; i < n; i++) {
    cin >> nums[i];
    count[nums[i]]++;
  }

  // 计算最少交换次数
  int swaps = 0;
  int correct_position = 0;

  for (int color = 0; color < 3; color++) {
    for (int i = 0; i < count[color]; i++) {
      if (nums[correct_position] != color) {
        swaps++;
      }
      correct_position++;
    }
  }

  // 输出结果
  cout << swaps / 2 << endl;

  return 0;
}
